﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.Linq.Expressions;
using System.IO;

namespace WoW_Downloader.Model
{
    class ViewModelBase : INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler PropertyChanged;

        protected void RaisePropertyChanged(string propertyName)
        {
            if (PropertyChanged != null)
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
        }

        protected void RaisePropertyChanged<TResult>(Expression<Func<TResult>> propertyExpression)
        {
            RaisePropertyChanged(((MemberExpression)propertyExpression.Body).Member.Name);
        }
    }

    class DownloadModel : ViewModelBase
    {

        private double m_TbcProgress;

        public double TbcProgress
        {
            get
            {
                return m_TbcProgress;
            }
            set
            {
                if (m_TbcProgress != value)
                {
                    this.m_TbcProgress = value;
                    RaisePropertyChanged("TbcProgress");
                }
            }
        }


        private double m_WotlkProgress;

        public double WotlkProgress
        {
            get
            {
                return m_WotlkProgress;
            }
            set
            {
                if (m_WotlkProgress != value)
                {
                    this.m_WotlkProgress = value;
                    RaisePropertyChanged("WotlkProgress");
                }
            }
        }


        private string m_TbcDownloadSpeed;

        public string TbcDownloadSpeed
        {
            get
            {
                return m_TbcDownloadSpeed;
            }
            set
            {
                if (m_TbcDownloadSpeed != value)
                {
                    this.m_TbcDownloadSpeed = value;
                    RaisePropertyChanged("TbcDownloadSpeed");
                }
            }
        }

        
        private string m_TbcUploadSpeed;

        public string TbcUploadSpeed
        {
            get
            {
                return m_TbcUploadSpeed;
            }
            set
            {
                if (m_TbcUploadSpeed != value)
                {
                    this.m_TbcUploadSpeed = value;
                    RaisePropertyChanged("TbcUploadSpeed");
                }
            }
        }



        private string m_WotlkDownloadSpeed;

        public string WotlkDownloadSpeed
        {
            get
            {
                return m_WotlkDownloadSpeed;
            }
            set
            {
                if (m_WotlkDownloadSpeed != value)
                {
                    this.m_WotlkDownloadSpeed = value;
                    RaisePropertyChanged("WotlkDownloadSpeed");
                }
            }
        }


        private string m_WotlkUploadSpeed;

        public string WotlkUploadSpeed
        {
            get
            {
                return m_WotlkUploadSpeed;
            }
            set
            {
                if (m_WotlkUploadSpeed != value)
                {
                    this.m_WotlkUploadSpeed = value;
                    RaisePropertyChanged("WotlkUploadSpeed");
                }
            }
        }

        
        private int m_GlobalUploadSpeed;

        public int GlobalUploadSpeed
        {
            get
            {
                return m_GlobalUploadSpeed;
            }
            set
            {
                if (m_GlobalUploadSpeed != value)
                {
                    this.m_GlobalUploadSpeed = value;
                    RaisePropertyChanged("GlobalUploadSpeed");
                }
            }
        }

        
        private int m_GlobalDownloadSpeed;

        public int GlobalDownloadSpeed
        {
            get
            {
                return m_GlobalDownloadSpeed;
            }
            set
            {
                if (m_GlobalDownloadSpeed != value)
                {
                    this.m_GlobalDownloadSpeed = value;
                    RaisePropertyChanged("GlobalDownloadSpeed");
                }
            }
        }
        
        
        
        private int m_PortNumber;

        public int PortNumber
        {
            get
            {
                return m_PortNumber;
            }
            set
            {
                if (m_PortNumber != value)
                {
                    this.m_PortNumber = value;
                    RaisePropertyChanged("PortNumber");
                }
            }
        }

        
        private DirectoryInfo m_SavePath;

        public DirectoryInfo SavePath
        {
            get
            {
                return m_SavePath;
            }
            set
            {
                if (m_SavePath != value)
                {
                    this.m_SavePath = value;
                    RaisePropertyChanged("SavePath");
                }
            }
        }
        
        
        
    }
}
